package com.eltsistemas.adapter;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Criptografia {
	
	/*
	 * Critografia MD5
	 */
	
	public String getMD5(String chave)
	{
		String md5 = null,
			   valor="9e107d9d0998ecf8427ecd98f00b20998ecf8";
        if(null == chave) return null;  
           
        try
        {  
	        //Create MessageDigest object for MD5  
	        MessageDigest digest = MessageDigest.getInstance("MD5");  
	           
	        //Update input string in message digest  
	        digest.update(chave.getBytes(), 0, chave.length());  
	  
	        //Converts message digest value in base 16 (hex)   
	        md5 = new BigInteger(1, digest.digest()).toString(16);  
  
        }
        catch (NoSuchAlgorithmException e) 
        {  
            e.printStackTrace();  
        }  
        return md5+valor;
	}

}
